{% extends "public/layout.html" %}

{% block css %}
<link href="/static/css/select2.min.css">
{% endblock %}


{% block body %}
    <form class="form-horizontal" action="#" method="post" parsley-validate id="basicvalidations">
        <div class="form-group">
            <label for="inputEmail3" class="col-sm-2 control-label">主机名</label>
            <div class="col-sm-5">
                <input type="email" class="form-control" id="inputEmail3" placeholder="{{ obj.hostname }}"
                       value="{{ obj.hostname }}" disabled>
            </div>
        </div>
        <div class="form-group">
            <label for="inputEmail3" class="col-sm-2 control-label">ip地址</label>
            <div class="col-sm-5">
                <input type="text" class="form-control" id="phone" name="ip_info" value="{{ obj.ip_info }}" disabled>
            </div>
        </div>
        <div class="form-group">
            <label for="inputPassword3" class="col-sm-2 control-label">状态</label>
            <div class="col-sm-5">
                <select class="form-control" name="status">
                    <option value="0">选择状态</option>
                    {% for status in status_obj_list %}
                        <option value="{{ status.name }}" {% if obj.status == status.name %}selected{% endif %}>{{ status.name }}</option>
                    {% endfor %}
                </select>
            </div>
        </div>

        <div class="form-group">
            <label for="name" class="col-sm-2 control-label">业务线 *</label>
            <div class="col-sm-5">
                <select data-placeholder="所属业务线" id="zhourudong" {% comment %}multiple{% endcomment %}
                        class="form-control control-label zhorudong"
                        tabindex="-1" name="product_id">
                    {% for product in product_obj %}
                        <option value="{{ product.id }}" {% if obj.product_set.all.first.name == product.name %}
                                selected
                        {% endif %}>{{ product.name }}</option>
                    {% endfor %}
                </select>
            </div>
        </div>


        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <input type="hidden" name="id" value="{{ obj.id }}">
                <button type="submit" class="btn btn-primary">提交</button>
            </div>
        </div>


    </form>



{% endblock %}

{% block js %}

    <script>

        $(document).ready(function () {
          //  $("#zhourudong option").remove();
           // $("#zhourudong").append("<option value='"+value+"'>"+text+"</option>");

            $(".zhorudong").chosen({disable_search_threshold: 10});

        });


    </script>
{% endblock %}

